inchar macro char
	push ax
	mov ah,1
	int 21h
	mov char,al

	mov dl,0ah
	mov ah,02h
	int 21h
	mov dl,0dh
	mov ah,02h
	int 21h

	pop ax
endm

outchar macro char
	push ax
	push dx
	mov dl,char
	mov ah,02h
	int 21h

	mov dl,0ah
	mov ah,02h
	int 21h
	mov dl,0dh
	mov ah,02h
	int 21h

	pop dx
	pop ax
endm

instring macro string,n
	local next,exit
	push ax
	push bx
	push cx
	push si

	mov cx,n
	mov si,0
	dec cx
next:
	mov ah,01h
	int 21h

	mov string[si],al
	inc si
	cmp al,0dh
	jz exit
	loop next
exit:
	mov al,24h
	mov string[si],al

	pop si
	pop cx
	pop bx
	pop ax
endm	

outstring macro string
	push ax
	push dx

	lea dx,string
	mov ah,09h
	int 21h

	mov dl,0ah
	mov ah,02h
	int 21h

	mov dl,0dh
	mov ah,02h
	int 21h

	pop dx
	pop ax
endm

outreg macro reg
	push ax
	push dx
	mov dl,reg
	mov ah,02h
	int 21h

	mov dl,0dh
	mov ah,02h
	int 21h
	mov dl,0ah
	mov ah,02h
	int 21h

	pop dx
	pop ax
endm

outflag macro flag
	push ax
	push dx
	push cx
	
	lahf
	mov cl,flag
	ror ah,cl
	and ah,1h

	mov dl,ah
	add dl,30h
	mov ah,02h
	int 21h

	mov dl,0dh
	mov ah,02h
	int 21h
	mov dl,0ah
	mov ah,02h
	int 21h

	pop cx
	pop dx
	pop ax
endm
